#!/bin/bash
#


function f_setting (){
	newdir="`pwd`/../../bin/"
	
	sed -i "s:^appdir=.*$:appdir=${newdir}:g" appLink_script
	cp -f  appLink_script /etc/init.d/appLink
	chmod +x /etc/init.d/appLink

}

function f_auto_server (){
	cd ../os
    		source os.sh
	cd -
	if [ "${linux_ret}" = "10010" -o "${linux_ret}" = "10020" -o "${linux_ret}" = "20010" ] ;  then
		app="`chkconfig --list |grep appLink|awk -F" " '{print $1}'`"
		if [ "${red}" = "appLink" ] ; then
			echo "appLink"
		else
			echo "now add appLink"
			chkconfig --add appLink
		fi
	elif [ "${linux_ret}" = "30010" ] ; then
		##先删除，后添加，防止重复
		update-rc.d -f appLink remove
		update-rc.d appLink defaults 80
	fi
}

f_setting
f_auto_server



